<?php
Yii::app()->clientScript->registerScript("manage_ttq_js","
var MANAGE_TTQ = {
    'indexTtqSetting':'".Yii::app()->createAbsoluteUrl('manage/index/setting')."',
    'indexGenerate':'".Yii::app()->createAbsoluteUrl('manage/index/generate')."',
};
",CClientScript::POS_HEAD);
?>

<div class="bk3">
    <div class="w200 fl">
        <a href="<?php echo Yii::app()->createUrl('ttq/index') ?>">
            <div class="chat-header">
                <div class="chat-header-left">
                    <span> </span>
                    <h2>涂涂圈</h2>
                </div>
                <div class="clear"></div>
            </div>
        </a>
    </div>
    <div class="clearfix"></div>
</div>
<?php if($role){ ?>
    <div class="contextual-links-region" id="index-ttq-setting-block">
        <div class="contextual-links-wrapper contextual-links-processed">
            <a href="javascript:void(0);" class="contextual-links-trigger">配置</a>
            <ul class="contextual-links">
                <li class="block-configure">
                    <a class="white fr manage-index-ttq-setting" title="设置" data-code="index_ttq_section" href="javascript:void(0);">
                        <i class="fa fa-cog"></i>&nbsp;配置
                    </a>
                </li>
                <li class="views-ui-edit first">
                    <a class="white fr manage-index-ttq-generate" title="生成" data-code="index_ttq_section" href="javascript:void(0);">
                        <i class="fa fa-share-alt"></i>&nbsp;生成
                    </a>
                </li>
            </ul>
        </div>
<?php } ?>
        <div class="bk4 mb10">
            <?php
            //if($this->beginCache('index_ttq_section', array('duration'=>3600))) {
            ?>
            <?php
            if ($info) {
                foreach ($info as $v) {
                    ?>
                    <div class="section">
                        <div class="section-img">
                            <img
                                src="<?php echo Yii::app()->easyImage->thumbSrcOf($v['info']['image_path'], array('resize' => array('width' => 287))); ?>">
                            <a href="<?php echo Yii::app()->createUrl('share/show', array('id' => $v['info']['id'])) ?>"
                               class="dt-img-cover" target="_blank"></a>
                        </div>
                        <div class="section-desc">
                            <a href="<?php echo Yii::app()->createUrl('share/show', array('id' => $v['info']['id'])) ?>"
                               class="section-title" target="_blank">
                                <?php echo Xtutuquan::cutstr($v['info']['content'], 30) ?>
                            </a>

                            <div class="section-attr">
                                <p class="te">
                                    -<a href="<?php echo Yii::app()->createUrl('ttq/index', array('type' => $v['info']['title_en'])); ?>"><?php echo $v['info']['title_cn'] ?></a>
                                </p>

                                <p>
                                    <i class="fa fa-star"></i>&nbsp;<?php echo $v['info']['total_forwarding'] ?>  <i
                                        class="fa fa-thumbs-o-up"></i>&nbsp;<?php echo $v['info']['total_like'] ?> <i
                                        class="fa fa-comment"></i>&nbsp;<?php echo $v['info']['total_comments'] ?>
                                </p>

                                <p>
                                    <time class="timeago ts-words"
                                          datetime="<?php echo date('Y-m-d H:i:s', $v['info']['create_time']); ?>"></time>
                                </p>
                                <p class="u_status">
                                    <a href="<?php echo Yii::app()->createUrl('people/index', array('domain' => $v['info']['domain'])) ?>"
                                       class="dt-username mr10" target="_blank">
                                        <img class="stat-people "
                                             src="<?php echo Xtutuquan::getAvatar($v['info']['uid'], 100); ?>"
                                             title="people-name"/>by <?php echo $v['info']['nick_name'] ?></a>
                                </p>
                            </div>
                        </div>
                    </div>
                <?php }
            } ?>
            <?php //$this->endCache(); } ?>
            <div class="clear"></div>
        </div>
<?php if($role){ ?>
        <script type="text/javascript">
            $(function () {
                $.getContextual("#index-ttq-setting-block");
            });
        </script>
    </div>
<?php } ?>
<?php if($role){ ?>
<div id="manage_index_ttq_setting" style="display: none;">
    <div style="width:350px;height:40px;float:left">
        <label for="ManageTtqNum" style="text-align: left;width: 50px;float:left">数量</label>
        <div style="margin-left: 70px;">
            <input type="text" value="<?php echo $num; ?>" placeholder="数量" id="ManageTtqNum">
        </div>
    </div>
    <div style="width:350px;height:40px;float:left">
        <label style="text-align: left;width: 50px;float:left" for="ManageTtqType">类型</label>
        <div style=" margin-left: 70px;">
            <select style="height: 30px;line-height: 30px" id="ManageTtqType">
                <option <?php if($type==1){ ?>selected="selected" <?php } ?> value="1">手动</option>
                <option <?php if($type==2){ ?>selected="selected" <?php } ?> value="2">自动</option>
                <option <?php if($type==3){ ?>selected="selected" <?php } ?> value="3">HTML</option>
            </select>
        </div>
    </div>
</div>
<?php } ?>